broadway_output_put_rgba (output, 0, 0, 0, 800, 600, 800*4,
cairo_image_surface_get_data(old_surface));
}
- broadway_output_move_surface (output, 0, 100 + i, 100 + i);
+ broadway_output_move_resize_surface (output, 0, 1, 100 + i, 100 + i, 0, 0, 0);
rects[0].x = 500;
rects[0].y = 0;
broadway_output_write (output, buf, sizeof (buf));
}
-void
-broadway_output_move_surface(BroadwayOutput *output, int id, int x, int y)
-{
- char buf[HEADER_LEN + 9];
- int p;
-
- p = write_header (output, buf, 'm');
-
- append_uint16 (id, buf, &p);
- append_uint16 (x, buf, &p);
- append_uint16 (y, buf, &p);
-
- assert (p == sizeof (buf));
-
- broadway_output_write (output, buf, sizeof (buf));
-}
void
-broadway_output_resize_surface(BroadwayOutput *output, int id, int w, int h)
+broadway_output_move_resize_surface (BroadwayOutput *output,
+ int id,
+ gboolean has_pos,
+ int x,
+ int y,
+ gboolean has_size,
+ int w,
+ int h)
{
- char buf[HEADER_LEN + 9];
+ char buf[HEADER_LEN+3+1+6+6];
int p;
+ int val;
- p = write_header (output, buf, 'r');
+ if (!has_pos && !has_size)
+ return;
- append_uint16 (id, buf, &p);
- append_uint16 (w, buf, &p);
- append_uint16 (h, buf, &p);
+ p = write_header (output, buf, 'm');
- assert (p == sizeof (buf));
+ val = (!!has_pos) | ((!!has_size) << 1);
+ append_uint16 (id, buf, &p);
+ buf[p++] = val + '0';
+ if (has_pos)
+ {
+ append_uint16 (x, buf, &p);
+ append_uint16 (y, buf, &p);
+ }
+ if (has_size)
+ {
+ append_uint16 (w, buf, &p);
+ append_uint16 (h, buf, &p);
+ }
+ assert (p <= sizeof (buf));
- broadway_output_write (output, buf, sizeof (buf));
+ broadway_output_write (output, buf, p);
}
void
int id);
void broadway_output_destroy_surface (BroadwayOutput *output,
int id);
-void broadway_output_move_surface (BroadwayOutput *output,
- int id,
- int x,
- int y);
-void broadway_output_resize_surface (BroadwayOutput *output,
- int id,
- int w,
- int h);
+void broadway_output_move_resize_surface (BroadwayOutput *output,
+ int id,
+ gboolean has_pos,
+ int x,
+ int y,
+ gboolean has_size,
+ int w,
+ int h);
void broadway_output_set_transient_for (BroadwayOutput *output,
int id,
int parent_id);
delete surfaces[id];
}
-function cmdMoveSurface(id, x, y)
+function cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h)
{
var surface = surfaces[id];
- surface.positioned = true;
- surface.x = x;
- surface.y = y;
+ if (has_pos) {
+ surface.positioned = true;
+ surface.x = x;
+ surface.y = y;
+ }
+ if (has_size) {
+ surface.width = w;
+ surface.height = h;
+ }
+
+ /* Flush any outstanding draw ops before (possibly) changing size */
+ flushSurface(surface);
if (surface.visible) {
if (surface.window) {
* However this isn't *strictly* invalid, as any WM could have done whatever it
* wanted with the positioning of the window.
*/
- surface.window.moveTo(surface.x, surface.y);
+ if (has_pos)
+ surface.window.moveTo(surface.x, surface.y);
+ if (has_size)
+ resizeBrowserWindow(surface.window, w, h);
} else {
- var xOffset = surface.x;
- var yOffset = surface.y;
+ if (has_size)
+ resizeCanvas(surface.canvas, w, h);
- var transientToplevel = getTransientToplevel(surface);
- if (transientToplevel) {
- xOffset = surface.x - transientToplevel.x;
- yOffset = surface.y - transientToplevel.y;
- }
+ if (has_pos) {
+ var xOffset = surface.x;
+ var yOffset = surface.y;
- var element = surface.canvas;
- if (surface.frame) {
- element = surface.frame;
- var offset = getFrameOffset(surface);
- xOffset -= offset.x;
- yOffset -= offset.y;
- }
+ var transientToplevel = getTransientToplevel(surface);
+ if (transientToplevel) {
+ xOffset = surface.x - transientToplevel.x;
+ yOffset = surface.y - transientToplevel.y;
+ }
- element.style["left"] = xOffset + "px";
- element.style["top"] = yOffset + "px";
- }
- }
+ var element = surface.canvas;
+ if (surface.frame) {
+ element = surface.frame;
+ var offset = getFrameOffset(surface);
+ xOffset -= offset.x;
+ yOffset -= offset.y;
+ }
- if (surface.window) {
- updateBrowserWindowGeometry(surface.window, true);
- } else {
- sendConfigureNotify(surface);
+ element.style["left"] = xOffset + "px";
+ element.style["top"] = yOffset + "px";
+ }
+ }
}
-}
-
-function cmdResizeSurface(id, w, h)
-{
- var surface = surfaces[id];
-
- surface.width = w;
- surface.height = h;
-
- /* Flush any outstanding draw ops before changing size */
- flushSurface(surface);
-
- resizeCanvas(surface.canvas, w, h);
if (surface.window) {
- resizeBrowserWindow(surface.window, w, h);
updateBrowserWindowGeometry(surface.window, true);
} else {
sendConfigureNotify(surface);
case 'm': // Move a surface
id = base64_16(cmd, i);
i = i + 3;
- x = base64_16(cmd, i);
- i = i + 3;
- y = base64_16(cmd, i);
- i = i + 3;
- cmdMoveSurface(id, x, y);
- break;
-
- case 'r': // Resize a surface
- id = base64_16(cmd, i);
- i = i + 3;
- w = base64_16(cmd, i);
- i = i + 3;
- h = base64_16(cmd, i);
- i = i + 3;
- cmdResizeSurface(id, w, h);
+ var ops = cmd.charCodeAt(i++) - 48;
+ var has_pos = ops & 1;
+ if (has_pos) {
+ x = base64_16s(cmd, i);
+ i = i + 3;
+ y = base64_16s(cmd, i);
+ i = i + 3;
+ }
+ var has_size = ops & 2;
+ if (has_size) {
+ w = base64_16(cmd, i);
+ i = i + 3;
+ h = base64_16(cmd, i);
+ i = i + 3;
+ }
+ cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h);
break;
case 'i': // Put image data surface
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
GdkBroadwayDisplay *broadway_display;
gboolean changed;
+ gboolean with_resize;
changed = FALSE;
changed = TRUE;
window->x = x;
window->y = y;
- if (broadway_display->output != NULL)
- {
- broadway_output_move_surface (broadway_display->output,
- impl->id, x, y);
- queue_dirty_flush (broadway_display);
- }
}
-
+ with_resize = FALSE;
if (width > 0 || height > 0)
{
+ with_resize = TRUE;
if (width < 1)
width = 1;
impl->dirty = TRUE;
impl->last_synced = FALSE;
- if (broadway_display->output != NULL)
- {
- broadway_output_resize_surface (broadway_display->output,
- impl->id, width, height);
- queue_dirty_flush (broadway_display);
- }
-
window->width = width;
window->height = height;
_gdk_broadway_window_resize_surface (window);
GdkEvent *event;
GList *node;
+ if (broadway_display->output != NULL)
+ {
+ broadway_output_move_resize_surface (broadway_display->output,
+ impl->id,
+ with_move, window->x, window->y,
+ with_resize, window->width, window->height);
+ queue_dirty_flush (broadway_display);
+ }
+
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);
event->configure.x = window->x;